package object;

import java.sql.SQLOutput;

public class ObjectDemo {
    public static void main(String[] args) {
        //输出引用变量时默认调用Object的tostring()方法;
        /*Point p =new Point(100,345);
        System.out.println(p);
        System.out.println(p.toString());*/

        Point p1 =new Point(100,200);
        Point p2=new Point(100,200);
        System.out.println(p1==p2);//比较的是地址，无意义
        System.out.println(p1.equals(p2));//比较的也是地址，所以需要重写

        String s1 ="hello";
        String s2 ="hello";
        System.out.println(s1.equals(s2));//String中重写了equal是()


        StringBuilder b1 =new StringBuilder("hello");
        StringBuilder b2 =new StringBuilder("hello");
        System.out.println(b1.equals(b2));//StringBuilder中没有重写equals()






    }
}
